package top.tagao.m02_creationalPatterns.c_01_builder.builders;

import com.sun.xml.internal.ws.api.pipe.Engine;
import top.tagao.m02_creationalPatterns.c_01_builder.cars.Car;

/**
 * 具体建造者(Concrete Builder）
 *
 * @author fu-xiao-liu
 * @Date 2022/7/24 14:33
 */
public class CarBuilder implements Builder {
    private String type;
    private int seats;
    private String engine;
    private String transmission;
    private String tripComputer;
    private String gpsNavigator;

    private Car car;

    @Override
    public void setCarType(String type) {
        this.type = type;
    }

    @Override
    public void setSeats(int seats) {
        this.seats = seats;
    }

    @Override
    public void setEngine(String engine) {
        this.engine = engine;
    }

    @Override
    public void setTransmission(String transmission) {
        this.transmission = transmission;
    }

    @Override
    public void setTripComputer(String tripComputer) {
        this.tripComputer = tripComputer;
    }

    @Override
    public void setGPSNavigator(String gpsNavigator) {
        this.gpsNavigator = gpsNavigator;
    }

    public Car getResult() {
        car = new Car(type, seats, engine, transmission, tripComputer, gpsNavigator);
        return car;
    }
}
